<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>比较运算符demo</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
    </style>
</head>
<body>
	<div class="container">
		<h1>比较运算符demo</h1>
		<input type="number" name="age">
		<span id="errorTips"></span>
	</div>

<script type="text/javascript"> 
var span = document.querySelector('#errorTips');
document.querySelector('[name=age]')
.addEventListener('keyup', function() {
	var errorTips = ''
	if(this.value > 90) {
		errorTips = '年龄不能超过90岁'
	}
	span.innerText = errorTips;
})

/*
 let span = document.querySelector("#msg");
  document
    .querySelector('[name="age"]')
    .addEventListener("keyup", function() {
      span.innerHTML = this.value >= 90 ? "年龄不能超过90岁" : "";
    });
    
 */

</script>
</body>
</html>